// loadimage.cpp : contains a simple function that accepts an ansi string
// and creates an image object from it
#include "stdafx.h"

//Loads an image from a file
Gdiplus::Image* LoadImageFromFile( const std::string& filename )
{
	//Create a unicode buffer
	wchar_t *ufile = new wchar_t[filename.length()+1];

	//Convert the ansi string to the unicode buffer
	MultiByteToWideChar(CP_ACP, 0, filename.c_str(), -1, ufile, filename.length()+1);

	//Create the image
	Gdiplus::Image* pImg = new Gdiplus::Image( ufile );

	//Wipe the buffer
	delete[] ufile;

	//Return the image file
	return pImg;
}